<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Random access</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Random_access"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Random_access rootpage-Random_access skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Random access</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1305433154">
/* start https://en.wikipedia.org/ */
.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}
/* end https://en.wikipedia.org/ */
</style>
<p><b>Random access</b> (also called <b>direct access</b>) is the ability to access an arbitrary element of a sequence in equal time or any datum from a population of <a href="Address_space" title="Address space">addressable</a> elements roughly as easily and efficiently as any other, no matter how many elements may be in the set. In <a href="Computer_science" title="Computer science">computer science</a> it is typically contrasted to <a href="Sequential_access" title="Sequential access">sequential access</a> which requires data to be retrieved in the order it was stored.
</p><p>For example, data might be stored notionally in a single sequence like a row, in two dimensions like rows and columns on a surface, or in multiple dimensions. However, given all the coordinates, a program can access each record about as quickly and easily as any other. In this sense, the choice of datum is arbitrary in the sense that no matter which item is sought, all that is needed to find it is its address, i.e. the coordinates at which it is located, such as its row and column (or its track and record number on a <a href="Drum_memory" title="Drum memory">magnetic drum</a>). At first, the term "random access" was used because the process had to be capable of finding records no matter in which sequence they were required.<sup id="cite_ref-Exposition1957_1-0" class="reference"><a href="#cite_note-Exposition1957-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> However, soon the term "direct access" gained favour because one could directly retrieve a record, no matter what its position might be.<sup id="cite_ref-Division1966_2-0" class="reference"><a href="#cite_note-Division1966-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> The operative attribute, however, is that the device can access any required record immediately on demand. The opposite is <a href="Sequential_access" title="Sequential access">sequential access</a>, where a remote element takes longer time to access.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p><p>A typical illustration of this distinction is to compare an ancient <a href="Scroll_(parchment)" class="mw-redirect" title="Scroll (parchment)">scroll</a> (sequential; all material prior to the data needed must be unrolled) and the <a href="Book" title="Book">book</a> (direct: can be immediately flipped open to any arbitrary <a href="Page_(paper)" title="Page (paper)">page</a>). A more modern example is a cassette tape (sequential — one must fast forward through earlier songs to get to later ones) and a <a href="CD" class="mw-redirect" title="CD">CD</a> (direct access — one can skip to the track wanted, knowing that it would be the one retrieved).
</p><p>In <a href="Data_structure" title="Data structure">data structures</a>, direct access implies the ability to access any entry in a <a href="List_(computing)" class="mw-redirect" title="List (computing)">list</a> in <a href="Constant_time" class="mw-redirect" title="Constant time">constant time</a> (independent of its position in the list and of the list's size). Very few data structures can make this guarantee other than <a href="Array_data_structure" class="mw-redirect" title="Array data structure">arrays</a> (and related structures like <a href="Dynamic_array" title="Dynamic array">dynamic arrays</a>). Direct access is required, or at least valuable, in many algorithms such as <a href="Binary_search" title="Binary search">binary search</a>, <a href="Integer_sorting" title="Integer sorting">integer sorting</a>, or certain versions of <a href="Sieve_of_Eratosthenes" title="Sieve of Eratosthenes">sieve of Eratosthenes</a>.<sup id="cite_ref-KNUTH1969_4-0" class="reference"><a href="#cite_note-KNUTH1969-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p>Other data structures, such as <a href="Linked_list" title="Linked list">linked lists</a>, sacrifice direct access to permit efficient inserts, deletes, or re-ordering of data. <a href="Self-balancing_binary_search_tree" title="Self-balancing binary search tree">Self-balancing binary search trees</a> may provide an acceptable compromise, where access time is not equal for all members of a collection, but the maximum time to retrieve a given member grows only <a href="Logarithmically" class="mw-redirect" title="Logarithmically">logarithmically</a> with its size.
</p>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-Exposition1957-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-Exposition1957_1-0">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFNational_Computer_Conference_and_Exposition1957" class="citation book cs1">National Computer Conference and Exposition (1957). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=lQQrAQAAIAAJ"><i>Proceedings</i></a><span class="reference-accessdate">. Retrieved <span class="nowrap">2 October</span> 2013</span>.</cite></span>
</li>
<li id="cite_note-Division1966-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-Division1966_2-0">^</a></b></span> <span class="reference-text"><cite class="citation book cs1"><a rel="nofollow" class="external text" href="https://books.google.com/books?id=i6vWAAAAMAAJ"><i>Introduction to IBM Direct-access Storage Devices and Organization Methods</i></a>. International Business Machines Corporation. 1966. pp. 3–<span class="reference-accessdate">. Retrieved <span class="nowrap">2 October</span> 2013</span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://technet.microsoft.com/en-us/library/cc938619.aspx">"Random and Sequential Data Access"</a>.</cite></span>
</li>
<li id="cite_note-KNUTH1969-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-KNUTH1969_4-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFD._E._KNUTH1969" class="citation book cs1">D. E. KNUTH (1969). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=ZQu9mgEACAAJ"><i>The Art of Computer Programming. Vol. 3. Sorting and Searching</i></a>. Addison-Wesley. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-201-03803-3</bdi><span class="reference-accessdate">. Retrieved <span class="nowrap">2 October</span> 2013</span>.</cite></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Data_stream" title="Data stream">Data stream</a></li>
<li><a href="Random-access_machine" title="Random-access machine">Random-access machine</a></li>
<li><a href="Random-access_memory" title="Random-access memory">Random-access memory</a> although the <a href="Cache_(computing)" title="Cache (computing)">cache</a> and <a href="Virtual_memory" title="Virtual memory">virtual memory</a> make this no longer truly random access.</li>
<li><a href="Locality_of_reference" title="Locality of reference">Locality of reference</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-01-30" href="https://en.wikipedia.org/wiki/?title=Random_access&oldid=1272840301">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>